<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link href="<%=path%>/pattern/cm/css/list_public_new.css"
			type="text/css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css"
			href="<%=path%>/pattern/flexigrid/css/flexigrid/flexigrid.css">
		<script type="text/javascript"
			src="<%=path%>/pattern/jquery-ui-1.7.1.custom/js/jquery-1.3.2.min.js"></script>
		<script type="text/javascript"
			src="<%=path%>/pattern/flexigrid/flexigrid.js"></script>
		<script src="<%=path%>/pattern/cm/js/list_public.js"
			language="javascript" type="text/javascript"></script>
		<script src="<%=path%>/pattern/cm/js/date1.js"
			language="javascript" type="text/javascript"></script>
		<title>无标题文档</title>
		
		<script type="text/javascript">
		function deleteSelected() {
			var selectFlags = document.getElementsByName("selectFlag");
			var flag = false;
			var index = 0;
			var ids='';
			for (var i=0; i<selectFlags.length; i++) {
				if (selectFlags[i].checked) {
				    //已经有选中的checkbox
					flag = true;
					index = i;
					ids+=selectFlags[i].value;
					ids+=',';
				}
			}
			if (!flag) {
				alert("请选择需要删除的数据！");
				return;
			}	
			
			//删除提示
			if (window.confirm("确认删除当前数据？")) {
				with(document.forms[0]) {
					action='<%=basePath%>testAction.action?type=del&ids='+ids;
					method="post";
					submit();
				}
			}
		}	
		</script>
	</head>
	<body>

		<div id="layout">
			<div class="title">
				测试
			</div>
			
			<div class="handle" id="search" >
				<table width="98%" border="0" cellspacing="0" cellpadding="0"
					align="center">
					<tr>
						<td width="86%">
							<div id="search1" style="display: ">
								<form action="<%=basePath%>testAction.action?type=find_all_desc" method="post">
									<div class="search_input">
										起始时间：
										<input style="width:100px" type="text" name="beginDate"  id="beginDate" onclick="MyCalendar.SetDate(this)"/>
									</div>
									<div class="search_input">
										结束时间：
										<input style="width:100px" type="text" name="endDate" id="endDate" onclick="MyCalendar.SetDate(this)"/>
									</div>
									<div class="search_input">
										关键字段：
										<select name="keyWordtb" id="keyWordtb">
										<option value="name">名字</option>
										<option value="value">值</option>
										<option value="tm">时间</option>
										</select>
									</div>
									<div class="search_input">
										关键字：
										<input style="width:100px" type="text" name="keyWord" id="keyWord"/>
									</div>
									<div class="search_input">
										
										<input style="width:100px" type="hidden" name="timetb" value="tm"/>
									</div>
									
									<div class="search_input">
										<input type="submit"  value="查询" />
									</div>
								</form>
							</div>
						</td>
					</tr>
				</table>
			</div>
			
			<div class="list" id="list">
				<form name="data" method="post">
					<table class="flexme1">
						<thead>
							<tr>
								<th width="40">
									标记
								</th>
								<th width="94">
									名称
								</th>
								<th width="94">
									值
								</th>
								<th width="194">
									时间
								</th>
								<th width="92">
									操作
								</th>
							</tr>
						</thead>
						<tbody>
							<s:iterator value="list">
								<tr>
									<td>
										<input type="checkbox" name="selectFlag" value="<s:property value="id"/>">
									</td>
									<td>
										<s:property value="name"/>
									</td>
									<td>
										<s:property value="value"/>
									</td>
									<td>
										<s:property value="tm"/>
									</td>
									<td>
										操作
									</td>
								</tr>
							</s:iterator>
							
						</tbody>
					</table>
				</form>
			</div>
			<div class="bottom">
			<div id="records" style="float:left">
					<input type="button" style="color:red;float:left" onclick="deleteSelected()" value="删除选中项目"/>
				</div>
				<div class="pagefirst" 
					onclick="window.location.href='<%=basePath%>testAction.action?type=find_all_desc&currentPage=${firstPage}'"></div>
				<div class="pageup"
					onclick="window.location.href='<%=basePath%>testAction.action?type=find_all_desc&currentPage=${previousPage}'"></div>
				<div id="pages">
					${currentPage} of ${totalPages}
				</div>
				<div class="pagedown"
					onclick="window.location.href='<%=basePath%>testAction.action?type=find_all_desc&currentPage=${nextPage}'"></div>
				<div class="pagelast" 
					onclick="window.location.href='<%=basePath%>testAction.action?type=find_all_desc&currentPage=${lastPage}'"></div>
				<div id="records">
					共有 ${totalPages} 页  ,${totalRows} 条记录
				</div>
				
				<div class="return" onclick="javascript:history.go(-1);"></div>
				<div id="records" style="float: right">
					返回上一页
				</div>
				<div id="search1" style="float:right;display: " >
								<form action="<%=basePath%>testAction.action?type=delByTime" method="post">
									<div class="search_input">
										    【按时间删除】    起始时间：
										<input style="width:100px" type="text" name="beginDate"  id="beginDate" onclick="MyCalendar.SetDate(this)"/>
									</div>
									<div class="search_input">
										结束时间：
										<input style="width:100px" type="text" name="endDate" id="endDate" onclick="MyCalendar.SetDate(this)"/>
									</div>
									
									<div class="search_input">
										
										<input style="width:100px" type="hidden" name="timetb" value="tm"/>
									</div>
									
									<div class="search_input">
										<input type="submit"  value="删    除" />
									</div>
								</form>
							</div>
				
				<div class="clear"></div>
			</div>
		</div>
	</body>
	

</html>
